package main

import "fmt"

func main(){

	arr:=[]int{1,2,3,4,5,6,7,8,9,10,11}
	replace(arr)

	arr1:=[]int{1,2,3,4,5,6,7,8,9,10,11}
	replace1(arr1)
}

//数组反转
func replace(arr []int){
	for i:=0;i<len(arr)/2;i++{
		arr[i],arr[len(arr)-i-1] = arr[len(arr)-i-1],arr[i]
	}
	fmt.Println(arr)
}

//数组反转
func replace1(arr []int){
	var min int= 0
	var max int = len(arr)-1

	for i:=1;i<len(arr);i++{
		arr[min],arr[max] = arr[max],arr[min]

		min = i
		max = len(arr)-1-i

		if min>max{
			break
		}
	}

	fmt.Println(arr)
}